<?php include 'head.php';
?>

	

	<div id="shopcar" class="shopcar w1">
		<div class="title" ><img src="./images/shoppingtitle1.jpg"/></div>
		<div class="mt20">
			<?php if(!empty($_SESSION['cart'])):?>
			<table cellspacing="0" cellpadding="0" width="980">
				<tr class="color">
					<th width="120">商品</th>
					<th width="300">商品名</th>
					<th>单价</th>
					<th>数量</th>
					<th>小计</th>
					<th>操作</th>
				</tr>
				<?php foreach($_SESSION['cart'] as $key => $val):?>
					<tr class="goods">
						<td><img src="./upload/<?php echo $val['image']?>"  height="80"/></td>
						<td><?php echo $val['name']?></td>
						<td><?php echo $val['price']?></td>
						<td>
							<a href="cart_action.php?a=mf&id=<?php echo $key?>&value=<?php echo $_SESSION['cart'][$key]['num']-1?>"><div class="icon min"></div></a>
							<span><?php 
								if($val['num'] > $_SESSION['cart'][$key]['store']){
									echo $_SESSION['cart'][$key]['store'];
								}else{
									echo $val['num'];
								}
							?>&nbsp;</span>
							<a href="cart_action.php?a=mf&id=<?php echo $key?>&value=<?php echo $_SESSION['cart'][$key]['num']+1?>"><div class="icon add"></div></a>
						</td>
						<td>￥<?php echo number_format($val['price'] * $val['num'],2,'.',',') ?></td>
						<td><a href="cart_action.php?a=del&id=<?php echo $key?>">删除</a></td>
					</tr>
				<?php $total += $val['num'] * $val['price']?>
				<?php endforeach;?>
				<tr class="color count">
					<td><a href="cart_action.php?a=emp">清空购物车</a></td>
					<td colspan="5" style="text-align:right;"><span>总计：￥<?php echo number_format($total,2,'.',',') ?> </span></td>
				</tr>
				</table>
				<div class="bottom">
					<div class="right fr"> <a href="./index.php"><img src="./images/2013-12-05_144221.png"/></a>　　<a href="order_inf.php"><img src="./images/2013-12-05_103427.png"/></a></div>
					<div class="clear"></div>
				</div>
				
				
				<?php else:?>
					<div class="shop_empty" >购物车还没有货！亲，赶紧开心购物吧！！<a href="index.php">去购物</a></div>
				<?php endif;?>
			
		</div>
	</div>


<?php include 'footer.php';?>
